﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Imaginecup.recycling.Object;
using Imaginecup.factory;
using Imaginecup.recycling.Factory;
using Imaginecup.recycling.Stage;
using Imaginecup.Engine;
using Imaginecup.gameState.recycling.Entity;

namespace Imaginecup.gameState.recycling.GameMan
{
    public class StageManager : IManager
    {
        private IFactory m_StageFactory;
        private IStage m_RunnerStage;

        private bool m_bGameOver;
        private bool m_bGameClear;

        public StageManager()
        {
            m_bGameOver = false;
            m_bGameClear = false;
            m_StageFactory = new StageFactory();
        }
        public IStageBaseBehavior GetStage()
        {
            return (IStageBaseBehavior)m_RunnerStage;
        }

        public void Initialize()
        {
            m_RunnerStage = (IStage)m_StageFactory.GetObject(StageID.SELECT_STAGE);
            m_RunnerStage.SetChangeMan(this);
        }

        public bool IsGameOver()
        {
            return m_bGameOver;
        }

        public bool IsGameClear()
        {
            return m_bGameClear;
        }

        public void ChangeStage(StageID ID)
        {
            //start : 게임 상태 초기화(현재는 매니저가 하나이기 때문에 이대로 사용)
            m_bGameOver = false;
            m_bGameClear = false;
            //end
            m_RunnerStage.Release();
            m_RunnerStage = (IStage)m_StageFactory.GetObject(ID);
            m_RunnerStage.SetChangeMan(this);
            TileMap.SetCurrentStage(this);
        }

        public void SetGameOver(bool bGameState)
        {
            m_bGameOver = bGameState;
        }
        public void SetGameClear(bool bGameState)
        {
            m_bGameClear = bGameState;
        }

    }
}
